package com.example.cart.controller;

import com.example.common.Interface.cart.entity.dto.*;
import com.example.common.Interface.cart.service.CartService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/cart")
public class CartController {
    @Resource
    private CartService CartService;
    @PostMapping("/add")
    public AddItemRespDTO addItem(@RequestBody AddItemReqDTO request) {
        return CartService.addItem(request);
    }
    @PostMapping("/get")
    public GetCartRespDTO getCart(@RequestBody GetCartReqDTO request) {
        return CartService.getCart(request);
    }
    @PostMapping("/empty")
    public EmptyCartRespDTO emptyCart(@RequestBody EmptyCartReqDTO request) {
        return CartService.emptyCart(request);
    }

}
